package com.ssy.lingxi.purchase.entity.quotedprice;

import com.ssy.lingxi.purchase.api.dto.request.EnclosureUrlsRequest;
import com.ssy.lingxi.purchase.entity.converter.JpaJsonToEnclosureUrlsRequestListConverter;
import lombok.Data;

import javax.persistence.*;
import java.util.List;

/**
 * 采购报价轮次说明表
 *
 * @author wrc
 * @date 2021/1/26
 */
@Data
@Entity
@Table(schema = "public", name = "pu_quoted_price_turn",
        indexes = {@Index(name = "pu_quoted_price_turn_quoted_price_id_idx", columnList = "quotedPriceId")})
public class QuotedPriceTurn {

    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "quoted_price_turn_seq")
    @SequenceGenerator(sequenceName = "pu_quoted_price_turn_seq", name = "quoted_price_turn_seq", allocationSize = 1)
    private Long id;

    /**
     * 需求单ID
     */
    private Long purchaseInquiryId;

    /**
     * 报价单id
     */
    private Long quotedPriceId;

    /**
     * 报价轮次
     */
    private Integer turn;

    /**
     * 交付说明
     */
    private String deliveryDetails;

    /**
     * 付款说明
     */
    private String payDetails;


    /**
     * 税费说明
     */
    private String taxes;


    /**
     * 物流说明
     */
    private String logistics;


    /**
     * 包装说明
     */
    private String packRequire;

    /**
     * 其他说明
     */
    private String otherRequire;

    /**
     * 报价说明:附件
     */
    @Column(columnDefinition = "jsonb")
    @Convert(converter = JpaJsonToEnclosureUrlsRequestListConverter.class)
    private List<EnclosureUrlsRequest> enclosureUrls;

    /**
     * 状态：0.未完成；1.已完成；
     */
    private Integer status = 0;

    /**
     * 报价单摘要
     */
    private String quotedDetails;

    /**
     * 联系人
     */
    private String contacts;

    /**
     * 联系电话
     */
    private String tel;

    /**
     * 报价单号
     */
    private String quotedPriceNo;

    /**
     * 交易时间
     */
    private Long tradeTime;

    /**
     * 创建时间
     */
    private Long createTime = System.currentTimeMillis();
}
